package com.android.cookbook.activity;

import com.android.cookbook.R;
import com.android.cookbook.R.id;
import com.android.cookbook.R.layout;
import com.android.cookbook.util.Constant;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;

public class RecipeSearch extends Activity {

	final public static String item_search = "item";
	EditText item;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.item_search);
        
        Button next = (Button) findViewById(R.id.buscar);
        item = (EditText) findViewById(R.id.recipe_search);
        
        ImageView create = (ImageView) findViewById(R.id.create_search);
        
        create.setOnClickListener(new View.OnClickListener() {             
        	public void onClick(View view) {                   
        		Intent myIntentCreate = new Intent(view.getContext(),RecipeCreate.class);
            	startActivityForResult(myIntentCreate, 0);             
        	}          
        });

        ImageView home = (ImageView) findViewById(R.id.home);
        
        home.setOnClickListener(new View.OnClickListener() {             
        	public void onClick(View view) {                   
        		Intent myIntentCreate = new Intent(view.getContext(),CookBookActivity.class);
            	startActivityForResult(myIntentCreate, 0);             
        	}          
        });
        
        Button salir = (Button) findViewById(R.id.salir);
        
        next.setOnClickListener(new View.OnClickListener() {             
        	public void onClick(View view) {                   

        		Bundle bundle = new Bundle();                 
        		bundle.putString(Constant.TYPE_ID,item.getText().toString());                   
        		bundle.putString(Constant.TYPE_SEARCH,Constant.LIST_BY_NAME);
             
        		Intent myIntent = new Intent(view.getContext(),ListDriver.class);
        		myIntent.putExtras(bundle);                   
        		startActivityForResult(myIntent, 0);             
        	}          
        }); 

        salir.setOnClickListener(new View.OnClickListener() {             
        	public void onClick(View view) {                   
        		Intent myIntent = new Intent(view.getContext(),CookBookActivity.class);
        		startActivityForResult(myIntent, 0);             
        	}          
        }); 
        
    }
}
